package graphics.effects;
import tools.Floatmath;
import tools.Help;
import tools.Point;
public class GEFire extends GEffect {
	private static final float MAXSTEPS = 20;
	private Point lastAdd;
	public GEFire(Point pos, long duration) {
		super(pos, duration);
		lastAdd = new Point(pos);
	}
	public GEFire(Point pos) {
		super(pos, -1);
		lastAdd = new Point(pos);
	}
	public void add(Point dir, int amount) {
		PartSys.fire.emitParticle(node.pos, dir, amount);
	}
	public void addLine(Point dir, float stepsize){
		Point dx = node.pos.sub(lastAdd);
		float d = dx.length();
		int j=0;
		dx.sMul(1.0f/d);
		for(float i=0;i<(d/stepsize) && j < MAXSTEPS;i+=stepsize,j++){
			PartSys.fire.emitParticle(lastAdd.add(dx.mul(i)), dir.mul(1+Floatmath.random()), 2);
		}
		lastAdd = new Point(node.pos);
	}
}
